#pragma once

#include <vector>
#include "CanInterface.h"
#include "BlocksConsts.h"


class CanObserver;

class BlocksCan : public CanInterface
{
public:
	BlocksCan(CanObserver* canObserver, unsigned char width = WIDTH, unsigned char height = HEIGHT + FIGURE_COMPLEXITY);

	virtual unsigned char Width();
	virtual unsigned char RedLine();
	virtual unsigned char Height();
	virtual unsigned char CellSize();	

	virtual unsigned char ReadCell(unsigned x, unsigned y);
	virtual unsigned char& Cell(unsigned x, unsigned y);	
	
    virtual void Clear();
	virtual void CheckLines(unsigned lower, unsigned upper);

private:
	void _RemoveLine(unsigned line);

private:
	unsigned char	_height;
	unsigned char	_width; 

private:
    typedef std::vector<unsigned char> Cells;
	Cells			_cells;
	unsigned char	_cellSize;

private:
	CanObserver*	_observer;
};